﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace Solidi
{
	sealed class DependencyKey : IDependencyKey
	{
		private Type _type;
		private IComparable _name;

		public DependencyKey(Type type, IComparable name = null)
		{
			_type = type;
			_name = name;
		}

		public Type Type { get { return _type; } }

		public IComparable Name { get { return _name; } }

		public override string ToString()
		{
			if (_name == null)
			{
				return _type.FullName;
			}

			return String.Format(CultureInfo.InvariantCulture, "{0}:{1}", _type, _name);
		}
	}
}
